package com.shhic.hhplt.server.biz;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicLong;

import org.springframework.stereotype.Component;

import com.shhic.hhplt.server.model.DashboardInfo;

@Component
public class DashboardInfoContainer implements IDashboardInfoContainer{

	private Map<String,DashboardInfo> container = new ConcurrentHashMap<String,DashboardInfo>();
	private static AtomicLong globalIdGenerator = new AtomicLong(1);
	
	
	@Override
	public void issueInfo(DashboardInfo dashboardInfo) {
		dashboardInfo.setId(globalIdGenerator.incrementAndGet());
		container.put(dashboardInfo.getDashboardName(), dashboardInfo);
	}

	@Override
	public DashboardInfo getDashboardInfo(String dashboardName) {
		return container.get(dashboardName);
	}

}
